package _spring_test._tests._PropertyEditorJava;

import java.beans.*;
import java.lang.reflect.InvocationTargetException;

/**
 * @Author: huangya
 * @Date: 2019/12/26
 * @Description:
 */
public class _PropertyEditorJavaDemo {

    public static void main(String[] args) throws IntrospectionException, InvocationTargetException, IllegalAccessException {
        ChartBean chartBean = new ChartBean();
        chartBean.setTitlePosition("1");
        chartBean.setInverse(true);

        BeanInfo beanInfo = Introspector.getBeanInfo(ChartBean.class);
        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
//        Object invoke = propertyDescriptors[0].getReadMethod().invoke(chartBean);
//        Object invoke2 = propertyDescriptors[0].getWriteMethod().invoke(chartBean, false);
        PropertyEditor propertyEditor = propertyDescriptors[0].createPropertyEditor(null);
//        System.out.println(invoke);
//        propertyEditor.setAsText("false");
        System.out.println(propertyEditor.getValue());
    }
}
